@extends('admin.layout.layout', ['row' => @$page])

@section('contain')


    <div class="portlet">
        <div class="portlet-title">
            <div class="caption">
                <a href="/admin/" class="caption-home"><i class="fa fa-home"></i> </a>
                <a href="/admin/">{{ ts('Dashboard') }}</a>
                <i class="fa fa-angle-right"></i>
                @if(!empty($page['breadcrumb']))
                    @foreach($page['breadcrumb'] as $b)
                        <a href="{{ @$b['url'] }}">{{ @$b['text'] }}</a>
                        <i class="fa fa-angle-right"></i>
                    @endforeach
                @endif
                <span class="active">{{ @$page['title'] }}</span>
            </div>
            <div class="actions">
                <div class="item">
                    <a href="/{{ request()->path() }}/create" class="btn btn-sm btn-primary">{{ ts('addnew') }}</a>
                </div>
            </div>
        </div>

        <div>
            <table class="table table-s1" data-toggle="table">
                <thead>
                <tr>
                    <th></th>
                    <th>{{ ts('DEALERID') }}</th>
                    <th>{{ ts('COMPANYNAME') }}</th>
                    <th>{{ ts('CONTACTPERSON') }}</th>
                    <th>{{ ts('CONTACTINFORMATION') }}</th>
                    <th>{{ ts('STATUS') }}</th>
                    <th style="width:270px">{{ ts('OPTION') }}</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $v)
                    <tr class="item-list">
                        <td class="text-center">
                            <input type="checkbox" class="distributor_dealer_icheck" name="ids[]" value="{{ $v->id }}">
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->unique_id }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->company_name }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ @$v->first_name }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ $v->phone_number }}</div>
                        </td>
                        <td>
                            <div class="truncated-3">{{ $v->status ? ts('ACTIVE') : ts('DEACTIVE') }}</div>
                        </td>
                        <td>
                            <a class="btn btn-success btn-sm" href='/admin/dealer/{{ $v->id }}'>{{ ts('VIEW') }}</a>
                            <span class="btn btn-danger btn-sm" onclick="editDealerStatus({{ $v->id }}, {{ $v->status }})">{{ $v->status == 1 ? ts('active') : ts('DEACTIVE') }}</span>
                            <a class="btn btn-primary btn-sm" href='/admin/dealer/{{ $v->id }}/performance'>{{ ts('performance') }}</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            <div>
                <div class="row my-3">
                    <div class="col-auto">
                        <label style="cursor: pointer"><input type="checkbox" class="icheck_all" data-ele=".distributor_dealer_icheck"><span class="ml-2">{{ ts('SELECTALL') }}</span></label>
                        <span class="btn btn-primary ml-3" onclick="deleteAlliCheck('.distributor_dealer_icheck', '/admin/delete_dealers')">{{ ts('delete') }}</span>
                    </div>
                    <div class="col">
                        {{ $data->appends(request()->input())->links() }}
                    </div>
                </div>
            </div>
        </div>

    </div>


@endsection